
option explicit


class CProperty

    private m_oIProperty
    
    
    public property get oIProperty()
        set oIProperty = m_oIProperty
    end property

    public property set oIProperty(byval oINewProperty)
        set m_oIProperty = oINewProperty
    end property


    public function sClassName()
        sClassName = m_oIProperty.sClassName
    end function


    public function sId()
        sId = m_oIProperty.sId
    end function
    


    public property get sValue()
    
    	' Si es la propiedad qclass::description, aplico traduccion,
    	' Sino, Si es la propiedad qproperty::alias, aplico traduccion,
    	' Sino, no aplico traduccion.
    	
    	if lcase(me.sClassName) = "qclass" and lcase(me.sName) = "description" then
	        sValue =  oApp.oTranslator.Translation( m_oIProperty.sValue )
	    elseif lcase(me.sClassName) = "qproperty" and lcase(me.sName) = "alias" then
	        sValue =  oApp.oTranslator.Translation( m_oIProperty.sValue )
		else
	        sValue =  m_oIProperty.sValue
		end if	    	

    end property

    public property let sValue(byval xNewValue)
        m_oIProperty.sValue = cstr(xNewValue)
    end property
    

    public property get dValue()
        dValue = qdate_to_date(m_oIProperty.sValue)
    end property

    public property let dValue(byval xNewValue)
        m_oIProperty.sValue = date_to_qdate(xNewValue)
    end property


    
    public property get lValue()
        lValue = clng(m_oIProperty.sValue)
    end property

    public property let lValue(byval xNewValue)
        m_oIProperty.sValue = xNewValue
    end property
    

    
    public property get fValue()
        dim s
        
        s = m_oIProperty.sValue
        
'        if not Global.ConfigUSA then
'            s = replace(s, ".", ",")
'        end if

        fValue = cdbl( format(s,"0.000") )
    end property

    public property let fValue(byval xNewValue)
        m_oIProperty.sValue = replace(cdbl(xNewValue),",",".")
    end property
    

    public property get bValue()
        bValue = cbool(m_oIProperty.sValue)
    end property

    public property let bValue(byval xNewValue)

        if cstr(xNewValue) = "0" then
                                                m_oIProperty.sValue = "0"
        elseif cstr(xNewValue) = "1" then
                                                m_oIProperty.sValue = "1"
        elseif xNewValue = true then
                                                m_oIProperty.sValue = "1"
        elseif xNewValue = false then
                                                m_oIProperty.sValue = "0"
        else
                                                m_oIProperty.sValue = "0"
        end if
        
    end property

    
    public property get sInitValue()
        sInitValue = m_oIProperty.sInit_Value
    end property

    public property let sInitValue(byval sNewInitValue)
        m_oIProperty.sInit_Value = sNewInitValue
    end property


    public property get sType()
        sType = m_oIProperty.sType
    end property

    public property let sType(byval s)
        m_oIProperty.sType = s
    end property


    public property get sMode()
        sMode = m_oIProperty.sMode
    end property

    public property let sMode(byval s)
        m_oIProperty.sMode = s
    end property


    public property get sClassReferenced()
        sClassReferenced = m_oIProperty.sClass_Referenced()
    end property

    public property let sClassReferenced(byval s)
        m_oIProperty.sClassReferenced = s
    end property


    public property get sFieldReferenced()
        sFieldReferenced = m_oIProperty.sField_Referenced
    end property

    public property let sFieldReferenced(byval s)
        m_oIProperty.sFieldReferenced = s
    end property


    public property get sKeyReferenced()
        sKeyReferenced = m_oIProperty.sKey_Referenced
    end property

    public property let sKeyReferenced(byval s)
        m_oIProperty.sKey_Referenced = s
    end property


    public property get sName()
        sName = m_oIProperty.sName
    end property

    public property let sName(byval s)
        m_oIProperty.sName = s
    end property


    public property get sAlias()
        sAlias = oApp.oTranslator.Translation( m_oIProperty.sAlias )
    end property

    public property let sAlias(byval s)
        m_oIProperty.sAlias = s
    end property


    public property get sMask()
        sMask = m_oIProperty.sMask
    end property

    public property let sMask(byval s)
        m_oIProperty.sMask = s
    end property


    public property get sComment()
        sComment = m_oIProperty.sComment
    end property

    public property let sComment(byval s)
        m_oIProperty.sComment = s
    end property


    public property get sParentName()
        sParentName = m_oIProperty.sParentName
    end property

    public property let sParentName(byval s)
        m_oIProperty.sParentName = s
    end property


    public property get bDummy()
        bDummy = (m_oIProperty.sIs_Dummy <> "0")
    end property

    public property let bDummy(byval b)
        if b then
            m_oIProperty.sIs_Dummy = "1"
        else
            m_oIProperty.sIs_Dummy = "0"
        end if
    end property


    public property get bNullable()
        bNullable = (m_oIProperty.sIs_Nullable <> "0")
    end property

    public property let bNullable(byval b)
        if b then
            m_oIProperty.sIs_Nullable = "1"
        else
            m_oIProperty.sIs_Nullable = "0"
        end if
    end property


    public property get bInputVisible()
        bInputVisible = (m_oIProperty.sIs_Input_Visible <> "0")
    end property

    public property let bInputVisible(byval b)
        if b then
            m_oIProperty.sIs_Input_Visible = "1"
        else
            m_oIProperty.sIs_Input_Visible = "0"
        end if
    end property



    public property get bPrimaryKey()
        bPrimaryKey = (m_oIProperty.sIs_Primary_Key <> "0")
    end property

    public property let bPrimaryKey(byval b)
        if b then
            m_oIProperty.sIs_Primary_Key = "1"
        else
            m_oIProperty.sIs_Primary_Key = "0"
        end if
    end property



    public property get bInputReadonly()
        bInputReadonly = (m_oIProperty.sIs_Input_Readonly <> "0")
    end property

    public property let bInputReadonly(byval b)
        if b then
            m_oIProperty.sIs_Input_Readonly = "1"
        else
            m_oIProperty.sIs_Input_Readonly = "0"
        end if
    end property


    public property get bOutputVisible()
        bOutputVisible = (m_oIProperty.sIs_Output_Visible <> "0")
    end property

    public property let bOutputVisible(byval b)
        if b=true then
            m_oIProperty.sIs_Output_Visible = "1"
        elseif b=false then
            m_oIProperty.sIs_Output_Visible = "0"
        end if
    end property


    public property get bOutputReadOnly()
        bOutputReadOnly = (m_oIProperty.sIs_Output_ReadOnly <> "0")
    end property

    public property let bOutputReadOnly(byval b)
        if b then
            m_oIProperty.sIs_Output_ReadOnly = "1"
        else
            m_oIProperty.sIs_Output_ReadOnly = "0"
        end if
    end property


    public property get sOnInputActivate()
        sOnInputActivate = m_oIProperty.sOn_Input_Activate
    end property

    public property let sOnInputActivate(byval sFunctionName)
        m_oIProperty.sOn_Input_Activate = sFunctionName
    end property


    public property get sOnInputCommit()
        m_sOnInputCommit = m_oIProperty.sOn_Input_Commit
    end property

    public property let sOnInputCommit(byval sFunctionName)
        m_oIProperty.sOn_Input_Commit = sFunctionName
    end property

    public property get sOnInputBeginEdit()
        m_sOnInputActivate = m_oIProperty.sOn_Input_BeginEdit
    end property

    public property let sOnInputBeginEdit(byval sFunctionName)
        m_oIProperty.sOn_Input_BeginEdit = sFunctionName
    end property


    public property get sOnInputEndEdit()
        m_sOnInputEndEdit = m_oIProperty.sOn_Input_EndEdit
    end property

    public property let sOnInputEndEdit(byval sFunctionName)
        m_oIProperty.sOn_Input_EndEdit = sFunctionName
    end property

end class
